package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.junzhiit.nengji.cms.service.RebateCategoryService;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.RebateCategoryAddVO;
import com.junzhiit.nengji.cms.web.vo.RebateCategoryEditVO;
import com.junzhiit.nengji.cms.web.vo.RebateCategoryVO;
import com.junzhiit.nengji.cms.web.vo.ResultVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("rebate/category")
public class RebateCategoryController {

	@Autowired
	private RebateCategoryService rebateCategoryService;
	
	@ApiOperation(value = "获取返利列表")
	@RequestMapping(method = RequestMethod.GET)
	public Map<String, Object> findAll(DataTablesParamVO dtp, RebateCategoryVO rebateCategoryVO) {
		return rebateCategoryService.findAll(dtp, rebateCategoryVO);
	}
	
	@ApiOperation(value="根据id获取返利属性")
	@RequestMapping(value="/{id}",method=RequestMethod.GET)
	public ResultVO findById(@PathVariable String id){
		return rebateCategoryService.findById(id);
	}
	
	@ApiOperation(value="更新返利")
	@RequestMapping(value="/{id}",method=RequestMethod.PUT)
	public ResultVO update(@PathVariable String id,RebateCategoryEditVO rebateCategoryEditVO){
		return rebateCategoryService.update(id,rebateCategoryEditVO);
	}
	
	@ApiOperation(value="添加返利")
	@RequestMapping(method=RequestMethod.POST)
	public ResultVO add(RebateCategoryAddVO rebateCategoryAddVO){
		return rebateCategoryService.add(rebateCategoryAddVO);
	}
	
	@ApiOperation(value="删除")
	@RequestMapping(value="/{id}",method=RequestMethod.DELETE)
	public ResultVO delete(@PathVariable String id){
		return rebateCategoryService.delete(id);
	}
	
	
}
